﻿myApp.controller("UsefulInfoDetailController", function ($scope, $http, $modal, modalService, $routeParams, $location) {
    $scope.share = {};
    function pageInit() {
        var url = 'api/UsefulInfo/GetUsefulInfo/' + $routeParams.id;
        $http.get(url).success(function (data) {
            $scope.UsefulInfo = data.UsefulInfo;
          
            $scope.slides = data.pictureList;

            $scope.share.url = 'http://www.penangrealty.my/UsefulInfoDetail/' + $routeParams.id.toString();
            $scope.share.pictureUrl = $scope.slides ? $scope.slides[0].pictureURL : 'http://www.penangrealty.my/images/penang realty,Apartment,house,condominium,terrace house,semi d,detached,bungalow,high end luxury properties,landed properties,gated guarded house.png';
            $scope.share.title = $scope.UsefulInfo.Title 
            $scope.share.description =  "[" + $scope.UsefulInfo.Source + "] " + $scope.UsefulInfo.description 
                + '\n' + $scope.UsefulInfo.Details;
            document.title = "Penang Realty 世界地產 " + $scope.share.Title;
            $scope.$emit('newPageLoaded', { 'title': $scope.share.title, 'description': $scope.share.description });
        })

    }
    pageInit();
});